package com.tb.dubbo.service.impl;


import com.tb.dubbo.entity.User;
import com.tb.dubbo.service.UserService;

/**
 * 作者：tb
 * 描述：todo
 * 日期：Created in 2022/4/6 12:09
 *
 * @Version 1.0
 */
public class UserServiceImpl implements UserService {

    public UserServiceImpl(){
        System.out.println("创建了用户业务层对象");
    }

    @Override
    public User findUser(String uname) {
        User user = new User();
        if(uname.equals("zhangsan")){
            user.setUname("zhangsan");
            user.setPassword("123456");
        }else{
            user.setUname("lisi");
            user.setPassword("456789");
        }
        return user;
    }

    @Override
    public User login(User user) {
        User user1 = findUser(user.getUname());
        if(user1.equals(user)){
            return user;
        }
        return null;
    }
}
